/*
 * To change this template, choose Tools | Templates
 * and open the template in the editor.
 */

package modelo;

import java.io.Serializable;
import java.util.Date;
import java.util.List;
import javax.persistence.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.EnumType;
import javax.persistence.Enumerated;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

/**
 *
 * @author Dirac
 */
@Entity
@Table(name = "diploma")
public class Diploma implements Serializable {
    private static final long serialVersionUID = 1L;
    @Id
    @GeneratedValue(strategy = GenerationType.IDENTITY)
    @Basic(optional = false)
    @Column(name = "id")
    private Integer id;

    @Column(name = "aluno")
    private String aluno;

    @JoinColumn(name = "curso", referencedColumnName = "id")
    @ManyToOne(optional=false)
    private Curso curso;
    
    @OneToMany(mappedBy = "diploma")
    private List<TelefoneDiploma> telefoneDiplomas;

    @Column(name = "email")
    private String email;

    @OneToMany(mappedBy = "diploma")
    private List<SituacaoDoDiploma> situacaoDoDiplomas;

    @Enumerated(EnumType.STRING)
    private SituacaoDiploma situacaoDiploma;

    public Diploma() {
    }

    public Diploma(Integer id) {
        this.id = id;
    }

    public String getAluno() {
        return aluno;
    }

    public void setAluno(String aluno) {
        this.aluno = aluno;
    }

    public Curso getCurso() {
        return curso;
    }

    public void setCurso(Curso curso) {
        this.curso = curso;
    }

    public String getEmail() {
        return email;
    }

    public void setEmail(String email) {
        this.email = email;
    }

    public Integer getId() {
        return id;
    }

    public void setId(Integer id) {
        this.id = id;
    }

    public List<SituacaoDoDiploma> getSituacaoDoDiplomas() {
        return situacaoDoDiplomas;
    }

    public void setSituacaoDoDiplomas(List<SituacaoDoDiploma> situacaoDoDiplomas) {
        this.situacaoDoDiplomas = situacaoDoDiplomas;
    }

    public List<TelefoneDiploma> getTelefoneDiplomas() {
        return telefoneDiplomas;
    }

    public void setTelefoneDiplomas(List<TelefoneDiploma> telefoneDiplomas) {
        this.telefoneDiplomas = telefoneDiplomas;
    }

    public SituacaoDiploma getSituacaoDiploma() {
        return situacaoDiploma;
    }

    public void setSituacaoDiploma(SituacaoDiploma situacaoDiploma) {
        this.situacaoDiploma = situacaoDiploma;
    }


    @Override
    public int hashCode() {
        int hash = 0;
        hash += (id != null ? id.hashCode() : 0);
        return hash;
    }

    @Override
    public boolean equals(Object object) {
        // TODO: Warning - this method won't work in the case the id fields are not set
        if (!(object instanceof Diploma)) {
            return false;
        }
        Diploma other = (Diploma) object;
        if ((this.id == null && other.id != null) || (this.id != null && !this.id.equals(other.id))) {
            return false;
        }
        return true;
    }

    @Override
    public String toString() {
        return this.aluno + " - "+ this.curso.getNome();
    }

}
